package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.AlipayBean;
import com.lwj.liwanjia.impl.AlipayView;
import com.lwj.liwanjia.model.AlipayModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/16.
 */

public class AlipayPresenter {
    private AlipayView alipayView;
    private AlipayModel alipayModel;

    public AlipayPresenter(AlipayView alipayView) {
        this.alipayView = alipayView;
        alipayModel = new AlipayModel();
    }

    public void getAlipayInfo(Map<String, Object> map) {
        if (alipayView != null) {
            alipayModel.getAlipayInfo(map, new Subscriber<AlipayBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    alipayView.showError((Exception) e);
                }

                @Override
                public void onNext(AlipayBean alipayBean) {
                    alipayView.getAlipayInfo(alipayBean);
                }
            });
        }
    }
}
